package com.yhd.admin.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yhd.admin.bean.Role;
import com.yhd.admin.mapper.RoleMapper;
import com.yhd.admin.utils.PageUtils;
import com.yhd.admin.utils.QueryWrapper;

@Service
public class RoleServiceImpl implements RoleService {
	@Autowired
	private RoleMapper roleMapper;
	
	@Override
	public List<Role> getRoles(Role role, int page, int rows) {
		return roleMapper.selectRoles(new QueryWrapper<Role>(role, new PageUtils(page, rows)));
	}

	@Override
	public int getCount(Role role) {
		return roleMapper.selectCount(role);
	}

	@Override
	public int addRole(Role role) {
		return roleMapper.add(role);
	}

	@Override
	public Role getRoleByName(String name) {
		return roleMapper.selectRoleByName(name);
	}

	@Override
	public int updateRole(Role role) {
		return roleMapper.updateRole(role);
	}

}
